class ChecklistItemInstancesController < ApplicationController
  # GET /checklist_item_instances
  # GET /checklist_item_instances.json
  def index
    @checklist_item_instances = ChecklistItemInstance.all

    respond_to do |format|
      format.html # index.html.erb
      format.json  { render :json => @checklist_item_instances }
    end
  end

  # GET /checklist_item_instances/1
  # GET /checklist_item_instances/1.json
  def show
    @checklist_item_instance = ChecklistItemInstance.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json  { render :json => @checklist_item_instance }
    end
  end

  # GET /checklist_item_instances/new
  # GET /checklist_item_instances/new.json
  def new
    @checklist_item_instance = ChecklistItemInstance.new

    respond_to do |format|
      format.html # new.html.erb
      format.json  { render :json => @checklist_item_instance }
    end
  end

  # GET /checklist_item_instances/1/edit
  def edit
    @checklist_item_instance = ChecklistItemInstance.find(params[:id])
  end

  # POST /checklist_item_instances
  # POST /checklist_item_instances.json
  def create
    @checklist_item_instance = ChecklistItemInstance.new(params[:checklist_item_instance])

    respond_to do |format|
      if @checklist_item_instance.save
        flash[:notice] = 'ChecklistItemInstance was successfully created.'
        format.html { redirect_to(@checklist_item_instance) }
        format.json  { render :json => @checklist_item_instance, :status => :created, :location => @checklist_item_instance }
      else
        format.html { render :action => "new" }
        format.json  { render :json => @checklist_item_instance.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /checklist_item_instances/1
  # PUT /checklist_item_instances/1.json
  def update
    @checklist_item_instance = ChecklistItemInstance.find(params[:id])

    respond_to do |format|
      if @checklist_item_instance.update_attributes(params[:checklist_item_instance])
        flash[:notice] = 'ChecklistItemInstance was successfully updated.'
        format.html { redirect_to(@checklist_item_instance) }
        format.json  { head :ok }
      else
        format.html { render :action => "edit" }
        format.json  { render :json => @checklist_item_instance.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /checklist_item_instances/1
  # DELETE /checklist_item_instances/1.json
  def destroy
    @checklist_item_instance = ChecklistItemInstance.find(params[:id])
    @checklist_item_instance.destroy

    respond_to do |format|
      format.html { redirect_to(checklist_item_instances_url) }
      format.json  { head :ok }
    end
  end
end
